package com.zz.concurrent.jxl;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;

import java.io.File;

/**
 * Author: zhangzhen
 * DATE: Created in 2018/8/16 10:50
 * Description:
 */
public class JxlReadExcel {

    public static void main(String[] args) {

        try {
            // 创建workbook
            Workbook workbook = Workbook.getWorkbook(new File("e:/jxl_test.xls"));
            // 获取第一个工作表sheet
            Sheet sheet = workbook.getSheet(0);
            // 获得数据
            for(int i = 0; i < sheet.getRows(); i++) {
                for(int j = 0; j < sheet.getColumns(); j++) {
                    Cell cell = sheet.getCell(j,i);
                    System.out.print(cell.getContents() + " ");
                }
                System.out.println();
            }
            workbook.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
